﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Collections.Specialized;
using System.Runtime.Serialization;

namespace Devfw.OpenAuth
{
    /// <summary>
    /// request token返回内容
    /// </summary>
    [Serializable()]
    public class RequestTokenResponse : NameValueCollection
    {
        public RequestTokenResponse()
            : base()
        {
        }

        protected RequestTokenResponse( SerializationInfo info, StreamingContext context )
            : base( info, context )
        {
        }

        public RequestTokenResponse( string query )
            : base( HttpUtility.ParseQueryString( query ) )
        {
        }

        public RequestTokenResponse( NameValueCollection nvcQuery )
            : base( nvcQuery )
        {
        }

        public string oauth_token
        {
            get
            {
                return this["oauth_token"];
            }
            set
            {
                this["oauth_token"] = value;
            }
        }

        public string oauth_token_secret
        {
            get
            {
                return this["oauth_token_secret"];
            }
            set
            {
                this["oauth_token_secret"] = value;
            }
        }

        public bool oauth_callback_confirmed
        {
            get
            {
                try
                {
                    return Convert.ToBoolean( this["oauth_callback_confirmed"] );
                }
                catch
                {
                    return false;
                }
            }
            set
            {
                this["oauth_callback_confirmed"] = value.ToString();
            }
        }
    }  

    
}
